package com.java.dao;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Types;
import java.util.ArrayList;
import java.util.HashMap;

import com.java.db.CommonConnect;
import com.java.util.DaoUtils;

public class Com0102lp01UpdateDao extends CommonDao{
	
	public ArrayList execute(HashMap requestMap,Connection con) {
		
        CallableStatement call = null;
        String Result_Val = "";
		ArrayList list = new ArrayList();

		try {
	        call = con.prepareCall("{call com_com0102Update( ?, ?, ?, ?, ?, ?, ?, ? )}");
	        
			
			String poi_cd[] 	= (String[])requestMap.get("poi_cd");
			String kisu_id[] 	= (String[])requestMap.get("kisu_id");
			String ent_id[] 	= (String[])requestMap.get("ent_id");
			String member_id[] 	= (String[])requestMap.get("member_id");
			String app_chk[] 	= (String[])requestMap.get("app_chk");
			String cancel_chk[] = (String[])requestMap.get("cancel_chk");
			String user_id[] 	= (String[])requestMap.get("user_id");
			
			String param[] = new String[7];
			for(int i=0; i<poi_cd.length; i++){
	            call.setString(1, poi_cd[i]);
	            call.setString(2, kisu_id[i]);
	            call.setString(3, ent_id[i]);
	            call.setString(4, member_id[i]);
	            call.setString(5, app_chk[i]);
	            call.setString(6, cancel_chk[i]);
	            call.setString(7, user_id[i]);
	            
	            System.out.println("넘겨온값  update =====>" + " poi_cd===>"+poi_cd[i]+ " kisu_id===>" + kisu_id[i]+ " member_id===>" + member_id[i]+ " app_chk===>" + app_chk[i]+ " cancel_chk===>" + cancel_chk[i]);
	            
	            call.registerOutParameter(8, Types.VARCHAR);     //Err Value
	            
	            call.execute();
	            
	            Result_Val = call.getString(8);
				
			}
			
			list.add(Result_Val);

		} catch (Exception ee) {
			ee.printStackTrace();
		}finally {
			if(call != null)
                try { call.close(); } catch(Exception e) { call = null; }
			try{
				if (con!=null) con.setAutoCommit(true);
				if (con!=null) con.close();
			}catch(Exception ee){}
		}
		return list;
	}
}
